import { request, upload } from './request';

export const login = async params => {
  const result = await request('/auth/login', 'POST', params);
  return result;
};

export const getUserInfo = async () => {
  const result = await request('/xcx/ai/getUserInfo', 'GET');
  return result;
};

export const updateUserInfo = async params => {
  const result = await request('/xcx/ai/editUserInfo', 'POST', params);
  return result;
};

export const uploadAvatar = async tempFilePath => {
  const resp = await upload('/xcx/ai/avatar', tempFilePath, 'avatarfile');
  return resp;
};

export const getSmsCode = async phone => {
  const resp = await request('/xcx/ai/getPhoneAuthCode', 'GET', { phone });
  return resp;
};
